package BusinessLogic;

import com.google.gson.Gson;
import java.io.FileWriter;
import java.io.IOException;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Edwin, Cristian
 */
public class RDF_XML_Transformer {

    public RDF_XML_Transformer() {

    }

    public String GetJsonTransformation(Object objectToConvert) {
        Gson gson = new Gson();

	// convert java object to JSON format,
        // and returned as JSON formatted string
        String json = gson.toJson(objectToConvert);

        return json;
    }
    
    public void SaveJsonTransformation(String json, String fileName){
        try {
            //write converted json data to a file named "file.json"
            FileWriter writer = new FileWriter(fileName);
            writer.write(json);
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
